//
//  YZChatMessageSystemCell.m
//  CocoaAsyncSocketClient
//
//  Created by lixiaoyi on 2018/6/29.
//  Copyright © 2018年 lixiaoyi. All rights reserved.
//

#import "YZChatMessageSystemCell.h"
#import "YZMessageFrame.h"
#import "YZMessageModel.h"
#import "YZMessage.h"
#import "UIView+Extension.h"

#define labelFont [UIFont systemFontOfSize:11.0]


@implementation YZChatMessageSystemCell

+ (instancetype)cellWithTableView:(UITableView *)tableView
                        reusabled:(NSString *)ID {
    
    YZChatMessageSystemCell *cell = [[YZChatMessageSystemCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:ID];
    cell.selectionStyle = UITableViewCellSelectionStyleNone;
    return cell;
    
}

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        self.backgroundColor           = [UIColor clearColor];
        self.selectionStyle            = UITableViewCellSelectionStyleNone;

        self.timeLabel.text = self.messageF.model.message.content;
        [self.contentView addSubview:self.timeLabel];
    }
    return self;
}

- (UILabel *)timeLabel {
    if (!_timeLabel) {
        _timeLabel = [[UILabel alloc] init];
        _timeLabel.backgroundColor = IColor(206, 206, 206);
        _timeLabel.textColor       = [UIColor whiteColor];
        _timeLabel.textAlignment   = NSTextAlignmentCenter;
        _timeLabel.font            = labelFont;
        _timeLabel.layer.masksToBounds  = YES;
        _timeLabel.layer.cornerRadius   = 5.0;
        _timeLabel.width = 40;
        _timeLabel.numberOfLines        = 1;
    }
    
    return _timeLabel;
}

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
